/**
 * 
 */
package np.com.baralsujan.login.util;

import java.util.ArrayList;
import java.util.List;

/**
 * @author sujan
 *
 */
public class CustomList {
	
	private List<String> list;
	private int counter;
	private int capacity;

	public CustomList(List<String> list, int capacity) {
		this.list = list;
		this.capacity = capacity;
		counter = 0;
	}
	
	public boolean hasMore() {
		return list.size() > counter;
	}
	
	public List<String> next() {
		List<String> nextList = new ArrayList<String>();
		do {
			nextList.add(list.get(counter));
		} while((++counter % capacity) != 0 && counter < list.size());
		return nextList;
	}

}
